#!/usr/bin/env node

// 06-radio.js
const { EventEmitter } = require('./05-event');

class Radio extends EventEmitter {
  constructor(station) {
    super();
    this.station = station;
    // 延迟 0 秒发出 play 事件
    setTimeout(() => {
      this.emit('play', station);
    }, 0);
    // 延迟 5 秒发出 stop 事件
    setTimeout(() => {
      this.emit('stop', station);
    }, 5000);
  }
}

module.exports = Radio;